
package com.joysuch.wwyt.risk;

public enum EvaluationPlanStrategies {

    YEAR("year", "每年一次"),
    HALF_YEAR("half-year", "半年一次"),
    SEASON("season", "三个月一次"),
    MONTH("month", "每月一次"),
    WEEK("week", "每周一次"),
    FIXED("fixed", "固定时间"),
    CHANGED("changed", "该区域发生信息变更后");

    String code;
    String name;

    private EvaluationPlanStrategies(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static EvaluationPlanStrategies findByCode(String code) {
        EvaluationPlanStrategies[] values = EvaluationPlanStrategies.values();
        for (EvaluationPlanStrategies e : values) {
            if (e.getCode().equals(code)) {
                return e;
            }
        }
        return null;
    }

    public static String findNameByCode(String code) {
        EvaluationPlanStrategies e = findByCode(code);
        if (e == null) {
            return null;
        }
        return e.name;
    }
}
